你可以在后台异步通知之前,通过查询接口确认支付状态。通过charge
对象的id
查询一个已创建的charge
对象。
注:针对「线下扫码」渠道:1、如果支付结果在 5 秒内未成功,则每隔 5 秒循环调用该查询接口来判断实际支付结果。如果用户主动放弃支付或累计 1 分钟内用户都未支付,则退出查询流程后继续调用 撤销 Charge 关闭支付交易,该笔订单按失败处理;2、isv_scan
场景:当用户因为免密次数限制或者其他特殊原因,导致同步返回的 Charge 未支付时,需要 5 秒间隔调用 Charge 查询接口更新订单状态。
请求参数 | 描述 |
---|---|
CHARGE_ID required string | 查询的 charge 对象 id ,该参数仅需要填写在请求地址内。 |
返回
返回一个已存在的 charge
对象或者一个错误,详见 错误。
GET https://api.pingxx.com/v1/charges/{CHARGE_ID}
\Pingpp\Charge::retrieve({CHARGE_ID});
Charge.retrieve({CHARGE_ID});
Pingpp::Charge.retrieve({CHARGE_ID})
pingpp.charges.retrieve({CHARGE_ID});
ch = pingpp.Charge.retrieve('CHARGE_ID')
ch, err := charge.Get("CHARGE_ID")
retrieve(String id)
curl https://api.pingxx.com/v1/charges/ch_L8qn10mLmr1GS8e5OODmHaL4 \ -u sk_test_ibbTe5jLGCi5rzfH4OqPW9KC:
\Pingpp\Pingpp::setApiKey('sk_test_ibbTe5jLGCi5rzfH4OqPW9KC');
\Pingpp\Charge::retrieve('ch_L8qn10mLmr1GS8e5OODmHaL4');
Pingpp.apiKey = "sk_test_ibbTe5jLGCi5rzfH4OqPW9KC";
Charge.retrieve("ch_L8qn10mLmr1GS8e5OODmHaL4");
Pingpp.api_key = "sk_test_ibbTe5jLGCi5rzfH4OqPW9KC"
Pingpp::Charge.retrieve("ch_L8qn10mLmr1GS8e5OODmHaL4")
var pingpp = require('pingpp')('sk_test_ibbTe5jLGCi5rzfH4OqPW9KC');
pingpp.charges.retrieve(
"ch_L8qn10mLmr1GS8e5OODmHaL4",
function(err, charge) {
// 异步调用
}
);
pingpp.api_key = 'sk_test_ibbTe5jLGCi5rzfH4OqPW9KC'
ch = pingpp.Charge.retrieve('ch_L8qn10mLmr1GS8e5OODmHaL4')
pingpp.Key = "sk_test_ibbTe5jLGCi5rzfH4OqPW9KC"
ch, err := charge.Get("ch_L8qn10mLmr1GS8e5OODmHaL4")
try {
Charge ch = Charge.retrieve("ch_L8qn10mLmr1GS8e5OODmHaL4");
Console.WriteLine(ch);
} catch (Exception e) {
Console.WriteLine(e.Message.ToString());
}
{
"id": "ch_L8qn10mLmr1GS8e5OODmHaL4",
"object": "charge",
"created": 1410834527,
"livemode": true,
"paid": false,
"refunded": false,
"reversed": false,
"app": "app_1Gqj58ynP0mHeX1q",
"channel": "upacp",
"order_no": "123456789",
"client_ip": "127.0.0.1",
"amount": 100,
"amount_settle": 100,
"currency": "cny",
"subject": "Your Subject",
"body": "Your Body",
"extra":{},
"time_paid": null,
"time_expire": 1410838127,
"time_settle": null,
"transaction_no": null,
"refunds": {
"object": "list",
"url": "/v1/charges/ch_L8qn10mLmr1GS8e5OODmHaL4/refunds",
"has_more": false,
"data": [ ]
},
"amount_refunded": 0,
"failure_code": null,
"failure_msg": null,
"metadata": {},
"credential": {
"object": "credential",
"upacp": {
"tn": "201409161028470000000",
"mode": "01"
}
},
"description": null
}